Skip to content

Conversation

pranikum
Copy link
Contributor

Description

We will be adding support of having S3 repository to support both client side and server side encryption enabled blobs. Currently BlobStoreRepository only supports Single BlobStore created Lazily and once created the repository is tied to that BlobStore.

With this change we will be moving away from that design. We will be adding BlobStoreProvider which will be responsible for creating client side encrypted and server side encrypted BlobStore. Any Repository which needs this support can leverage by overriding appropriate builder methods.

Related Issues

[Resolves #[(https://github.com//issues/19235]

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@pranikum pranikum changed the title Sse blobstore changes [RemoteStore]: Add support for repository with Server side encryption enabled and client side encryption as well based on a flag. Oct 14, 2025
@pranikum pranikum force-pushed the sse-blobstore-changes branch from c6051f6 to 01b6ca2 Compare October 14, 2025 16:01
Signed-off-by: Pranit Kumar <[email protected]>
Copy link
Contributor

✅ Gradle check result for 7b1273c: SUCCESS

Copy link

codecov bot commented Oct 14, 2025

Codecov Report

❌ Patch coverage is 74.50000% with 51 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.14%. Comparing base (252cff8) to head (3560a0a).
⚠️ Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
...org/opensearch/cluster/metadata/IndexMetadata.java 20.00% 8 Missing ⚠️
...arch/repositories/blobstore/BlobStoreProvider.java 78.94% 6 Missing and 2 partials ⚠️
...ch/repositories/blobstore/BlobStoreRepository.java 80.00% 6 Missing and 1 partial ⚠️
...java/org/opensearch/index/shard/StoreRecovery.java 0.00% 6 Missing ⚠️
...e/metadata/TransportRemoteStoreMetadataAction.java 0.00% 4 Missing ⚠️
...in/java/org/opensearch/index/shard/IndexShard.java 20.00% 4 Missing ⚠️
...c/main/java/org/opensearch/index/IndexService.java 0.00% 3 Missing ⚠️
...ndex/store/RemoteSegmentStoreDirectoryFactory.java 72.72% 2 Missing and 1 partial ⚠️
...va/org/opensearch/indices/RemoteStoreSettings.java 57.14% 2 Missing and 1 partial ⚠️
.../main/java/org/opensearch/index/IndexSettings.java 60.00% 2 Missing ⚠️
... and 3 more
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #19630      +/-   ##
============================================
+ Coverage     73.11%   73.14%   +0.02%     
- Complexity    70661    70723      +62     
============================================
  Files          5724     5727       +3     
  Lines        323498   323651     +153     
  Branches      46852    46866      +14     
============================================
+ Hits         236518   236721     +203     
- Misses        67846    67853       +7     
+ Partials      19134    19077      -57     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Pranit Kumar <[email protected]>
@pranikum pranikum self-assigned this Oct 16, 2025
Signed-off-by: Pranit Kumar <[email protected]>
Copy link
Contributor

❕ Gradle check result for 3560a0a: UNSTABLE

Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure.

Comment on lines 1249 to 1252
scopedSettings.addSettingsUpdateConsumer(
IndexMetadata.INDEX_REMOTE_STORE_SSE_ENABLED_SETTING,
this::setServerSideEncryptionEnabled
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a dynamic setting , hence we don't need it .

Looks like Index's custom metadata is the right place for it .

public static final String REMOTE_STORE_REPOSITORY_SETTINGS_ATTRIBUTE_KEY_PREFIX = "remote_store.repository.%s.settings.";

public static final String REPOSITORY_TYPE_ATTRIBUTE_KEY_FORMAT = "%s.repository.%s.type";
public static final String REPOSITORY_SERVER_SIDE_ENCRYPTION_ATTRIBUTE_KEY_FORMAT = "%s.repository.%s.server_side_encryption_enabled";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So to enable this we would need to have this in the repository metadata ? Can every repository have its own implementation for it rather ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though the BlobStoreRepository implementation is generic. Will move any call to RemoteStore related code from BlobStore. However We will need RemoteStore specific implementation when adding index specific setting since that flow will be specific to remote store.

}

public BlobStoreProvider getBlobStoreProvider() {
if (RemoteStoreNodeAttribute.isServerSideEncryptionEnabled(metadata.settings())) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of RemoteStoreNodeAttribute , can BlobStoreRepository tell if it is SSE based on its own attributes . For ex in s3, if SSE-KMS related settings are present we can infer it is SSE already .

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.. Will change this call to make it generic .

throw new UnsupportedOperationException();
}

protected BlobStore createClientSideEncryptedBlobStore() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

repository doesn't know if it is client side encryption or not . That construct is outside repository .

Also we can use server side + client side both . Good to honor all the server side encryption related settings for all request .

/**
* BlobStoreProvider for RemoteStoreProvider
*/
public class ServerSideEncryptionEnabledBlobStoreProvider extends BlobStoreProvider {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need two providers , since the signature of blobStore itself contains serverSideEncryptionEnabled

BlobStore blobStore(boolean serverSideEncryptionEnabled) 

segmentRepo = RemoteStoreNodeAttribute.getSegmentRepoName(remoteNode.get().getAttributes());
if (!isRestoreFromSnapshot
&& RemoteStoreSettings.isServerSideEncryptionRepoEnabled(clusterState.nodes().getMinNodeVersion())
&& RemoteStoreNodeAttribute.isRemoteStoreServerSideEncryptionEnabled(remoteNode.get().getAttributes(), segmentRepo)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can add a method in RemoteStoreNodeService about the same . RemoteStoreNodeService can use repository data and infer from it based on repository type.

Signed-off-by: Pranit Kumar <[email protected]>
Copy link
Contributor

❌ Gradle check result for cca7474: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants